<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>

<tiles:insertTemplate template="/tiles/layout.jsp">
	<tiles:putAttribute name="selected" value="gastos" />
	<tiles:putAttribute name="submenu">
		<ul>
			<li><a href="${pageContext.request.contextPath}/gastos/gasto.action" class="gastoadd">Registrar gasto</a></li>
			<li><a href="${pageContext.request.contextPath}/gastos/buscar.action" class="search">Buscar gasto</a></li>
			<sec:authorize access="hasRole('ROLE_ADMIN')">
				<li><a href="${pageContext.request.contextPath}/gastos/list-tipos.action" class="category">Tipos</a></li>
			</sec:authorize>
		</ul>
	</tiles:putAttribute>
	<tiles:putAttribute name="body">
		
		<div id="box">
		
		<h3>Consolidar Gasto</h3> 
		
		<div id="infobox" class="margin-left">
				<c:if test="${gasto.hierarchy == 'Prevision'}"><h3>Prevision</h3></c:if>
				<c:if test="${gasto.hierarchy == 'GastoReal'}"><h3>Gasto Real</h3></c:if>

				<table> 
					<thead>
					</thead>
					<tbody>
					<tr><td><b>Detalle</b></td><td><c:out value="${gasto.detalle}" /></td></tr>
					<tr><td><b>Edificio</b></td><td><c:out value="${gasto.edificio.nombre}" /></td></tr>
					<tr><td><b>Tipo</b></td><td><c:out value="${gasto.tipo.descripcion}" /></td></tr>
					<tr><td><b>Monto</b></td><td>$<c:out value="${gasto.monto}" /></td></tr>
			
			<c:if test="${gasto.hierarchy == 'Prevision'}">
				<tr><td><b>Mes</b></td><td><c:out value="${gasto.mes}" /></td></tr>
				<tr><td><b>A&ntilde;o</b></td><td><c:out value="${gasto.anio}" /></td></tr>
			</c:if>
			
			<c:if test="${gasto.hierarchy == 'GastoReal'}">
				<tr><td><b>Fecha</b></td><td><c:out value="${gasto.razonSocial}" /></td></tr>
				<tr><td><b>Forma de pago</b></td><td><c:out value="${gasto.formaPago}" /></td></tr>
				<tr><td><b>Nro de Factura</b></td><td><c:out value="${gasto.nroFactura}" /></td></tr>
				<tr><td><b>Raz&oacute;n Social</b></td><td><c:out value="${gasto.razonSocial}" /></td></tr>
			</c:if>
			</tbody>
		</table>
	</div> 

 	<div id="infobox" class="margin-left">
 		<s:actionerror/>
 		<s:fielderror/>
		<s:form action="consolidar" id="form" namespace="/gastos">
			<fieldset id="gasto">
				<legend>Consolidar</legend>
				<s:hidden name="gasto.id"></s:hidden>
				<s:textfield name="gasto.folio" label="Nro de Folio" maxlength="10" required="true"/>
			</fieldset>
		

			
			<div align="center">
            	<input id="button1" type="submit" value="Guardar" /> 
                <input id="button2" type="reset" />
			</div>
				
			</s:form>
					
		</div>
	</div>
	</tiles:putAttribute>
</tiles:insertTemplate>